/*
	Visp is an opensource visual performance application built with Adobe® AIR™.
	Copyright (C) 2007 Mike Creighton
	
	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
	
	Mike Creighton can be found at http://www.mikecreighton.com		
*/
package 
{
	import flash.display.Sprite;
	import flash.display.GradientType;
	import flash.display.InterpolationMethod;
	import flash.geom.Matrix;
	import com.visp.constants.OutputSize;
	
	/**
	 * CircGradBG is a simple class that draws a rectangle the size of the canvas
	 * with an inner color and an outer color. The gradient "center" is randomly
	 * offset to provide some variety.
	 */
	public class CircGradBG extends Sprite
	{
		public function CircGradBG(innerColor : uint, outerColor : uint)
		{
			super();
			
			var offsetMatrix : Matrix = new Matrix();
			offsetMatrix.createGradientBox( OutputSize.WIDTH*2, OutputSize.HEIGHT*2, 
											0, 
											Math.random() * OutputSize.WIDTH - OutputSize.WIDTH, 
											Math.random() * OutputSize.HEIGHT - OutputSize.HEIGHT
										   );
			this.graphics.beginGradientFill(GradientType.RADIAL, [innerColor, outerColor], [1,1], [50,255], offsetMatrix);
			this.graphics.drawRect(0, 0, OutputSize.WIDTH, OutputSize.HEIGHT);
			this.graphics.endFill();
		}
		
	}
}